<!DOCTYPE html>
<html lang="en">
	<head>
		<title> New Document </title>
		<meta charset="utf-8">
		<meta name="Author" content="">
		<meta name="Keywords" content="">
		<meta name="Description" content="">
		<meta name="viewport" content="width=device-width, initial-scale=1.0">
		<!-- Bootstrap -->
		<link href="${webRoot}resources/css/bootstrap.min.css" rel="stylesheet" media="screen">
		<link href="${webRoot}resources/css/style.css" rel="stylesheet">
		<script src="http://code.jquery.com/jquery-1.10.0.min.js"></script>
	</head>
<body class="main">
	<div class="wrap add-shop">
	<ul class="breadcrumb">
		    <li><span id="test">您当前的位置：</span><a href="#">首页</a> <span class="divider">>></span></li>
		    <li class="active">${upateGoods}</li>
	    </ul>
		<form class="form-horizontal" method="post"
			enctype="multipart/form-data"
			action="${webRoot}goods/updateGoodsInfo.do" id="goodsInfo">
			<input type="hidden" id="goods_id" name="goods_id" value="${goodsEntity.goods_id}">
		 <div class="control-group">
		    <label class="control-label" for="user_Id">所属商户</label>
		    <div class="controls">
				<select id="user_Id" name="user_Id">
				<#list listuser as userEntity>
				  <#if goodsEntity.user_Id==userEntity.user_Id>
				  <option value="${userEntity.user_Id}" selected="selected">${userEntity.user_Name}</option>
				  <#else>
				  <option value="${userEntity.user_Id}">${userEntity.user_Name}</option>
				  </#if>
				 </#list>
				</select>
		    </div>
		  </div>	
		  <div class="control-group">
		    <label class="control-label" for="goods_Name">商铺名称</label>
		    <div class="controls">
		      <input type="text" id="goods_Name" name="goods_Name" value="${goodsEntity.goods_Name}">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="goods_Jingdu">商铺经度</label>
		    <div class="controls">
		      <input type="text" id="goods_Jingdu" name="goods_Jingdu" value="${goodsEntity.goods_Jingdu}">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="goods_WeiDu">商铺纬度</label>
		    <div class="controls">
		      <input type="text" id="goods_WeiDu" name="goods_WeiDu" value="${goodsEntity.goods_WeiDu}">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="goods_telephone">联系电话</label>
		    <div class="controls">
		      <input type="text" id="goods_telephone" name="goods_telephone" value="${goodsEntity.goods_telephone}">
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="uplabel_id">商铺大分类</label>
		    <div class="controls">
				<select id="uplabel_id" name="uplabel_id" onchange="getLabelList()">
				<option value="">请选择</option>
				  <#list listUplabel as uplabelEntity>
					  <#if goodsEntity.uplabel_id==uplabelEntity.uplabel_id>
					  <option value="${uplabelEntity.uplabel_id}" selected="selected">${uplabelEntity.uplabel_name}</option>
					  <#else>
	 				  <option value="${uplabelEntity.uplabel_id}" >${uplabelEntity.uplabel_name}</option>
	 				  </#if>
				 </#list>
				</select>
		    </div>
		  </div>
		   <div class="control-group" id="labelId">
		    <label class="control-label" for="label_id">商铺小分类</label>
		    <div class="controls">
				<select id="label_id" name="label_id">
				  <option value="${labelEntity.label_id}">${labelEntity.label_name}</option>
				</select>
		    </div>
		  </div>		
		  <div class="control-group">
		    <label class="control-label" for="inputShopXY">商铺地址</label>
		    <div class="controls">
				<select class="w120" id="goods_citycode" name="goods_citycode">
				  <option value="0128">宜兴</option>
				</select>
				<select class="w120" id="goods_areacode" name="goods_areacode">
				  <#list listArea as areaEntity>
				   <#if goodsEntity.goods_areacode==areaEntity.areacode>
				  <option value="${areaEntity.areacode}" selected="selected">${areaEntity.areaname}</option>
				  <#else>
				   <option value="${areaEntity.areacode}">${areaEntity.areaname}</option>
				  </#if>
				 </#list>
				</select>
				<input type="text" id="goods_address"  name="goods_address" placeholder="详细地址：如新景数码港1103号" value="${goodsEntity.goods_address}">				
		    </div>
		  </div>
		  <div class="control-group">
		    <label class="control-label" for="goods_Desc">店铺简介</label>
		    <div class="controls">
		      <textarea rows="3" id="goods_Desc" name="goods_Desc">${goodsEntity.goods_Desc}</textarea>
		    </div>
		  </div>
		  <input type="hidden" id="goods_image" name="goods_image" value="${goodsEntity.goods_image}">
		  <div class="control-group">
				<label class="control-label" for="file">图片上传</label>
				<div class="controls">
					<input type="file" id="file" name="file">
					<div class="preview">
						<img src="${goodsEntity.goods_image}">
					</div>
				</div>
			</div>  		    
		  <div class="control-group">
		    <div class="controls">
		      <button type="button" class="btn" onclick="checkContext()">确认修改</button>
		    </div>
		  </div>
		</form>			 	
	</div>			
	<script src="${webRoot}resources/js/jquery-1.9.1.min.js"></script>
	<script src="${webRoot}resources/js/bootstrap.min.js"></script>
	<script src="${webRoot}resources/js/js.js"></script>
    <script type="text/javascript">
    function getLabelList(){
    	var uplabel = $("#uplabel_id").val();
    	if(uplabel!=null&&uplabel!=''){
    	$.ajax({url:"${webRoot}goods/getLabelList.do?uplabelId="+uplabel,
		   type:"post",
		   cache:"false",
		   error : function() {
			   alert("系统繁忙，请稍后再试！");
			},
		   success:function(msg){
			   $("#labelId").html(msg);
		   }
		});
    	}else{
    		$("#label_id").val("");
    	}
    }
    function checkContext(){
    	var goodsName = $("#goods_Name").val();
    	if($.trim(goodsName) == null ||$.trim(goodsName) =="" ){
    		alert("商铺名字不能为空！");
    		return;
    	}
    	var goodsJingdu= $("#goods_Jingdu").val();
    	if($.trim(goodsJingdu) == null ||$.trim(goodsJingdu) =="" ){
    		alert("商铺经度不能为空！");
    		return;
    	}
    	var goodsWeiDu= $("#goods_WeiDu").val();
    	if($.trim(goodsWeiDu) == null ||$.trim(goodsWeiDu) =="" ){
    		alert("商铺纬度不能为空！");
    		return;
    	}
    	var goodstelephone= $("#goods_telephone").val();
    	if($.trim(goodstelephone) == null ||$.trim(goodstelephone) =="" ){
    		alert("联系电话不能为空！");
    		return;
    	}
    	var uplabelId= $("#uplabel_id").val();
    	if($.trim(uplabelId) == null ||$.trim(uplabelId) =="" ){
    		alert("商铺所属大分类不能为空！");
    		return;
    	}
    	var labelId= $("#label_id").val();
    	if($.trim(labelId) == null ||$.trim(labelId) =="" ){
    		alert("商铺所属小分类不能为空！");
    		return;
    	}
    	var goodsAddress= $("#goods_address").val();
    	if($.trim(goodsAddress) == null ||$.trim(goodsAddress) =="" ){
    		alert("商铺的详细地址不能为空！");
    		return;
    	}
    	var goods_Desc= $("#goods_Desc").val();
    	if($.trim(goods_Desc) == null ||$.trim(goods_Desc) =="" ){
    		alert("商铺的简介不能为空！");
    		return;
    	}
    	document.getElementById("goodsInfo").submit();
    }
    </script>

</body>
</html>
